function Add-NonVolatileEnlistment {
<#
.SYNOPSIS
Creates a TFS workspace intended for mappings that rarely change and can be synced infrequently.

.PARAMETER Mappings
List of mappings to include in workspace. These can be piped froman existing workspace and you can use the BranchToken and LocalPathToken to replace new server and local path values to be used for this workspace.

.PARAMETER TfsUrl
The TFS Collection URL to use for connecting to TFS

.PARAMETER LocalSourcePath
Local path where the workspace mappings should be rooted to

.PARAMETER Branch
Server path from which to root mappings

.PARAMETER BranchToken
String in the server path of the Mappings to be replaced with the Branch parameter

.PARAMETER LocalPathToken
String in the local path of the Mappings to be replaced with the LocalSourcePath parameter. The default is 'c:\'.

.PARAMETER Force
If a wokspace already exists that was not created by BigGit then add these mappings to that workspace


.EXAMPLE
Invoke-TF workfold /workspace:"SomeOtherWorkspace;Matt Wrock" | Add-NonVolatileEnlistment -tfsUrl http://myserver:8080/tfs -localSourcePath "c:\dev\src\" -localPathToken "c:\" -Branch $/my/branch -BranchToken $/original/branch

This will create a new workspace based on the mappings of SomeOtherWorkspace and replace server path mappings starting with $/original/branch with $/my/branch and replace local path mappings starting with c:\ with c:\dev\src\

.EXAMPLE
Invoke-TF workfold /workspace:"SomeOtherWorkspace;Matt Wrock" | Add-NonVolatileEnlistment -tfsUrl http://myserver:8080/tfs -localSourcePath "c:\dev\src\" -localPathToken "c:\"

This will create a new workspace based on the mappings of SomeOtherWorkspace and replace local path mappings starting with c:\ with c:\dev\src\. The server paths will be copied from the original mappings.

.EXAMPLE
Add-NonVolatileEnlistment -mappings " $/my/branch/folder1: c:\dev\src\folder1"," $/my/branch/folder2: c:\dev\src\folder2" -tfsUrl http://myserver:8080/tfs -localSourcePath "c:\dev\src\"

This will create a new workspace and use the mappings passed in as is since no token parameters were used.

.NOTES
The top level local paths created by the mappings will be symbolically linked into the workspaces created by Add-PartialBranch, Add-VolitileEnlistment and Add-PartialBranchGitClone

.LINK
https://BigGit.Codeplex.com
Add-PartialBranch
Add-VolitileEnlistment
Add-PartialBranchGitClone
#>    
    param(
        [Parameter(position=0,Mandatory=$True,ValueFromPipeline=$True)]
        [string[]] $mappings,
        [Parameter(Mandatory=$true)]
        [string] $tfsUrl, 
        [Parameter(Mandatory=$true)]
        [string] $localSourcePath, 
        [string] $branch = $null,
        [string] $branchToken = '$/server/path/to/branch/', 
        [string] $localPathToken = 'c:\',
        [switch] $force
    )
    begin {
        Write-BigGitMessage "Creating NonVolatile Enlistment of $branch at $localSourcePath"  -backgroundColor darkgreen
        $pipedMappings = @()
    }
    process { 
        foreach($map in $mappings){
            $pipedMappings += $map
        }
    }
    end { 
        if(Add-Workspace $pipedMappings `
            -tfsUrl $tfsUrl `
            -localSourcePath $localSourcePath `
            -branch $branch `
            -branchToken $branchToken `
            -localPathToken $localPathToken `
            -force:$force){
            Set-BigGitConfig "NonVolatilePath" (resolve-path $localSourcePath).Path
        }
    }
}